package apkinser

import (
    "fmt"
    "bytes"
    "encoding/xml"
)

type Apk struct {
    Id string   `xml:"softid"`
    Url string  `xml:"downurl"`
}

type Server struct {
    XMLName xml.Name    `xml:"softinstall"`
    Interval string     `xml:"requestcircle"`
    Apks []Apk          `xml:"softlist>soft"`
}


func (s *Server) String() string {
    var buf bytes.Buffer
    fmt.Fprintf(&buf, "Interval:%s ApkNum:%d ", s.Interval, len(s.Apks))
    for _, apk := range s.Apks {
        fmt.Fprintf(&buf, "(Id:%s Url:%s) ", apk.Id, apk.Url)
    }
    return buf.String()
}
